package com.dstz.bpm.api.engine.plugin.def;

import com.dstz.base.core.util.StringUtil;
import com.dstz.bpm.api.engine.plugin.context.UserCalcPluginContext;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class UserAssignRule implements Comparable<UserAssignRule>, Serializable {
   private static final long serialVersionUID = 1L;
   private String name = "";
   private String description = "";
   private String condition = "";
   private int groupNo = 1;
   private List<UserCalcPluginContext> calcPluginContextList = new ArrayList();

   public String getName() {
      return this.name;
   }

   public void setName(String name) {
      this.name = name;
   }

   public String getDescription() {
      if (!StringUtil.isEmpty(this.description)) {
         return this.description;
      } else {
         String desc = "";

         UserCalcPluginContext ctx;
         for(Iterator var2 = this.calcPluginContextList.iterator(); var2.hasNext(); desc = desc + "　　　【" + ctx.getTitle() + "】" + ctx.getDescription() + ";") {
            ctx = (UserCalcPluginContext)var2.next();
         }

         return desc;
      }
   }

   public void setDescription(String description) {
      this.description = description;
   }

   public String getCondition() {
      return this.condition;
   }

   public void setCondition(String condition) {
      this.condition = condition;
   }

   public int getGroupNo() {
      return this.groupNo;
   }

   public void setGroupNo(int groupNo) {
      this.groupNo = groupNo;
   }

   public List<UserCalcPluginContext> getCalcPluginContextList() {
      return this.calcPluginContextList;
   }

   public void setCalcPluginContextList(List<UserCalcPluginContext> calcPluginContextList) {
      this.calcPluginContextList = calcPluginContextList;
   }

   public int compareTo(UserAssignRule userRule) {
      if (this.groupNo > userRule.groupNo) {
         return 1;
      } else {
         return this.groupNo < userRule.groupNo ? -1 : 0;
      }
   }
}
